<?php
/**
 *
 * @author: xaboy<365615158@qq.com>
 * @day: 2017/11/23
 */

namespace service;

class JiciWechatService extends WechatService
{
    public static function options()
    {
        $wechat = SystemConfigService::more(['wechat_appid','wechat_appsecret','wechat_token']);
        $payment = SystemConfigService::more(['pay_weixin_mchid','pay_weixin_client_cert','pay_weixin_client_key','pay_weixin_key','pay_weixin_open']);

        $config = [
            'app_id'=> 'wx1a2b2e79547a8121',//isset($wechat['wechat_appid']) ? $wechat['wechat_appid']:'',
            'secret'=> '866797146e43cf3cf38ce72008f7b9d6',//isset($wechat['wechat_appsecret']) ? $wechat['wechat_appsecret']:'',
            'token' => '4f17e5e8dc5705da4faa2adef70862fd',//isset($wechat['wechat_token']) ? $wechat['wechat_token']:'',
            'guzzle' => [
                'timeout' => 10.0, // 超时时间（秒）
            ],
        ];
        if(isset($payment['pay_weixin_open']) && $payment['pay_weixin_open'] == 1){
            $config['payment'] = [
                'merchant_id' => '1491015872',//1483470642,//$payment['pay_weixin_mchid'],
                'key'         => 'BC4E5748B58B56529F5AF44295A64DB4',//'dounixue670216xuezhaleyuanHUIJIA',//$payment['pay_weixin_key'],
                'cert_path'   => 'certs/wxpay/apiclient_cert.pem',//realpath('.'.$payment['pay_weixin_client_cert']),
                'key_path'    => 'certs/wxpay/apiclient_key.pem',//realpath('.'.$payment['pay_weixin_client_key']),
                'notify_url'  => SystemConfigService::get('site_url'). \think\Url::build('wap/Wechat/notify')
            ];
        }
        return $config;
    }
}